// 1.引入组件及接口
import { defineStore } from 'pinia'
import type { ReportDataModel } from '@/api/mock/model/data'
import { reqGetReportData } from '@/api/mock' //向mock服务器发送请求api

// 2.创建实例对象
// export const useReportDataStore = defineStore('reportData', {
// state: ():ReportDataModel => {
//   return {

//   }
// }
// })
export const useReportDataStore = defineStore({
  id: 'reportData',
  state() {
    return {
      // 对象中有一个属性是reportData 属性值还是对象
      reportData: {} as ReportDataModel,
    }
  },
  actions: {
    async getReportData() {
      const result = await reqGetReportData()
      // console.log('home', result)
      this.reportData = result
      // console.log(this.reportData.searchWord)
    },
  },
})
